﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Application.Interface;
using Domain.Dto;
using Domain.Dto.SampleModel.Event;
using Domain.Interface;
using Surging.Core.CPlatform.EventBus.Events;
using Surging.Core.EventBusRabbitMQ.Attributes;

namespace Application.EventHandling.SampleModel
{
    [QueueConsumer("SampleEventHandle")]
    public class SampleEventHanding : IIntegrationEventHandler<MySampleEvent>
    {
        private readonly ISampleModelService _modelService;

        public SampleEventHanding(ISampleModelService modelService)
        {
            _modelService = modelService;
        }

        public async Task Handle(MySampleEvent @event)
        {
            await _modelService.Create(input: new SampleModelCreateInput()
            {
                Title = @event.Title
            });
        }
    }
}
